package com.v1.video.domain;

import com.v1.video.util.Logger;

public class Header {

	private final String TAG = "Header";
    public Header(){
        
    }
    
	public Header(String keyType, String user_Id, String related_Video_Id,
			String title, String detail, String address, String scenario,
			String duration, String Content_Length, String filename,
			String sourceid, String ssotype, String comments) {
		this.keyType = keyType;
		this.user_Id = user_Id;
		this.related_Video_Id = related_Video_Id;
		this.title = title;
		this.detail = detail;
		this.address = address;
		this.scenario = scenario;
		this.duration = duration;
		this.Content_Length = Content_Length;
		this.filename = filename;
		this.sourceid = sourceid;
		this.ssotype = ssotype;
		this.comments = comments;
//		if(virtualAddress != null && !virtualAddress.equals("")){
//			this.comments = this.virtualAddress;
//		}
	}
	
	public Header(String keyType, String user_Id, String related_Video_Id,
			String title, String detail, String address, String scenario,
			String duration, String Content_Length, String filename,
			String sourceid, String ssotype, String comments,String albumName,
			String groupId,String friendsId,String virtualAddress,String activityId) {
		this.keyType = keyType;
		this.user_Id = user_Id;
		this.related_Video_Id = related_Video_Id;
		this.title = title;
		this.detail = detail;
		this.address = address;
		this.scenario = scenario;
		this.duration = duration;
		this.Content_Length = Content_Length;
		this.filename = filename;
		this.sourceid = sourceid;
		this.ssotype = ssotype;
		this.comments = comments;
		this.albumName = albumName;
		this.groupId = groupId;
		this.virtualAddress = virtualAddress;
		this.friendsId = friendsId;
		this.activityId = activityId;
		if(virtualAddress != null && !virtualAddress.equals("")){
			this.comments = this.virtualAddress;
		}
	}
	
	/**3期加话题，加分类*/
	public Header(String keyType, String user_Id, String related_Video_Id,
			String title, String detail, String address, String scenario,
			String duration, String Content_Length, String filename,
			String sourceid, String ssotype, String comments,String albumName,
			String groupId,String friendsId,String virtualAddress,String activityId,
			String theme,String categoryId,String deviceType,String videoWidth,String videoHeight) {
		this.keyType = keyType;
		this.user_Id = user_Id;
		this.related_Video_Id = related_Video_Id;
		this.title = title;
		this.detail = detail;
		this.address = address;
		this.scenario = scenario;
		this.duration = duration;
		this.Content_Length = Content_Length;
		this.filename = filename;
		this.sourceid = sourceid;
		this.ssotype = ssotype;
		this.comments = comments;
		this.albumName = albumName;
		this.groupId = groupId;
		this.virtualAddress = virtualAddress;
		this.friendsId = friendsId;
		this.activityId = activityId;
		if(virtualAddress != null && !virtualAddress.equals("")){
			this.comments = this.virtualAddress;
		}
		this.topicName = theme;
		this.categoryId = categoryId;
		this.deviceType = deviceType;
		this.videoWidth = videoWidth;
		this.videoHeight = videoHeight;
		Logger.i(TAG, "Content_Length=="+Content_Length);
	}
	
	public Header(Header headOld){
		this.keyType = headOld.keyType;
		this.user_Id = headOld.user_Id;
		this.related_Video_Id = headOld.related_Video_Id;
		this.title = headOld.title;
		this.detail = headOld.detail;
		this.address = headOld.address;
		this.scenario = headOld.scenario;
		this.duration = headOld.duration;
		this.Content_Length = headOld.Content_Length;
		this.filename = headOld.filename;
		this.sourceid = headOld.sourceid;
		this.ssotype = headOld.ssotype;
		this.comments = headOld.comments;
		this.albumName = headOld.albumName;
		this.groupId = headOld.groupId;		
		this.virtualAddress = headOld.virtualAddress;
		this.friendsId = headOld.friendsId;
		this.activityId = headOld.activityId;
		this.scenario1 = headOld.scenario1;
		this.related_Video_Id1 = headOld.related_Video_Id1;
		this.state = headOld.state;
		if(headOld.virtualAddress != null && !headOld.virtualAddress.equals("")){
			this.comments = headOld.virtualAddress;
		}
		
	}

	public String activityId = "";
	public String albumName = "";//专辑名称
	public String groupId = "";//圈子id
	public String virtualAddress = "";//虚拟地理位置
	public String friendsId = "";
	public String state = "0";//0上传中 1转码中2上传完成 通知服务器转码 3转码失败 
	public String filePath = "";
	public String keyType;// 操作指令

	public String user_Id;// 用户id

	public String related_Video_Id;// 相关视频id

	public String title;// 标题

	public String detail;// 简介

	public String address;// 视频上传地址

	public String scenario;// 视频场景(生活圈等)，二期本字段：用来存放groupId或activityId；

	public String duration;// 播放时间长度 秒

	public String Content_Length;// 视频上传的字节长度

	public String filename;// 视频原始名称

	public String sourceid;// 视频唯一标志 v1_视频

	public String ssotype;// 分享平台 1 新浪微博 2 腾讯微博 3新浪和腾讯一健分享//4期不用了；
	public String comments;// 分享评论内容
	public String related_Video_Id1;// 来源：圈子，普通，活动//4期不用了；
	public String scenario1;// 视频场景(生活圈等)，二期本字段：用来存放groupId或activityId；
	public String topicName = "";//话题
	public String categoryId = "";//分类ID
	public String deviceType = "";//设备类型：Android或IOS
	public String videoWidth;//视频宽//4期不用了；
	public String videoHeight;//视频高//4期不用了；
	
	/**
	 * 总大小（M）
	 * @return
	 */
	public float getUploadTotalSize(){
		float result = 0.0f;
		if(Content_Length == null || Content_Length.length() <= 0){
		      return 0;
		}
		result = Float.valueOf(Content_Length)/1024/1024;
		Logger.i(TAG, "result11111111111="+result);
		String value = result+"";
		if(value.contains(".")){
			int index = value.indexOf(".");
			String value1 = value.substring(index+1);
			if(value1.length() > 2){
				value1 = value1.substring(0, 2);
				String value2 = value.substring(0, index);
				value = value2+"."+value1;
				result = Float.valueOf(value);
			}
		}
		Logger.i(TAG, "fileLength="+Content_Length+"result="+result);
		return result;
	}
}
